﻿@using eCollabro.Client.Models;
@using eCollabro.Client.Models.Core
@using eCollabro.Web.Base;
@using eCollabro.Common;
@model UserModel
@{
    List<PermissionEnum> userPermissions = (List<PermissionEnum>)ViewBag.UserPermissions;
    bool canEdit = userPermissions.Contains(PermissionEnum.EditContent);
    bool canDelete = userPermissions.Contains(PermissionEnum.DeleteContent);
    bool canAdd = userPermissions.Contains(PermissionEnum.AddContent);
}
@Scripts.Render("~/bundles/user")
<div id="placeHolderUsers"></div>
<div id="divUsers" ng-controller="usersController" ng-init="initialize('@canAdd','@canEdit','@canDelete')">
    @{
        List<PageButton> pageButtons = new List<PageButton>();
        pageButtons.Add(new PageButton { Id = "btnRefresh", CssClass = "btn btn-warning", ButtonText = "Refresh", Icon = "refresh", Method = "loadUsers()" });
        if (canAdd)
        {
            pageButtons.Add(new PageButton { Id = "btnAdd", CssClass="btn btn-success", ButtonText = "Add User", Icon = "plus", Method = "openUser(0)" });
        }
    }
    @Html.Partial("_PageHeader", new PageHeaderModel { PageTitle = "Users", ViewId = "Users", PageButtons = pageButtons })
    <table style="width:100%" class="table table-striped table-bordered" id="tblUsers" cellspacing="0">
        <thead>
            <tr>
                <th>User Name</th>
                <th>User Email</th>
                <th>Active</th>
                <th>Confirmed</th>
                <th>Approved</th>
                <th>Locked</th>
                <th>Action</th>
            </tr>
        </thead>
    </table>

</div>